
**# Favors Provided Before and After Revolving-Door

use "program_replication_jop.dta", clear

encode jurisdiction, g(jurisdiction_id)
encode stkcd, g(stkcd_1)
drop stkcd
rename stkcd_1 stkcd
 
generate age_5yr = age

recode  age_5yr (min/50=1) (51/54=2) (55/59=3) (60/max= 4) 

label define age_5yr_lab 1 "50 yrs old below" 2 "51-54 yrs old"  ///
 3 "55-59 yrs old" 4 "60+ yrs old"

* generate log variables

g asset_l = log(TotalAsset+1)
g liability_l = log(TotalLiab+1)


label values age_5yr age_5yr_lab   
lab var subsidy_l "Subsidy Value (logged)"
lab var pre_hiring "Future Revolver"
lab var pre_hiring1 "Future Revolver in 1 yr"
lab var pre_hiring2 "Future Revolver in 2 yrs"
lab var pre_hiring3 "Future Revolver in 3 yrs"
lab var asset_l "Asset"
labe var liability_l "Liability"
lab var same_place "Same Place"
lab var rd_offic "Existing Revolvers"

global reg_rd  "~/Dropbox/revolving_door_jmp/result"

** specify firm controls
global firm_controls  asset_l liability_l

** regression setting
global reg_setting  lab dec(3)  nocons  drop($firm_controls) noas 

**# Table A.13； Summary Statistics for Program-level Analy

outreg2 using "$reg_rd/program_sum_stats.tex", replace sum(log) keep(subsidy_l pre_hiring pre_hiring1  pre_hiring2 pre_hiring3  $firm_controls same_place rd_offic ) lab 


**# Table A.14: Last Term Effect

reghdfe subsidy_l i.age_5yr $firm_controls if level != "province", absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_59analysis.tex", replace $reg_setting addtext("Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y") 


reghdfe subsidy_l i.age_5yr same_place  $firm_controls if level != "province", absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_59analysis.tex", append $reg_setting addtext("Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y") 


reghdfe subsidy_l i.age_5yr same_place rd_offic $firm_controls if level != "province", absorb(jurisdiction_id  year stkcd)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_59analysis.tex", append $reg_setting ///
addtext("Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y") 


reghdfe subsidy_l i.age_5yr same_place rd_offic $firm_controls if level != "province", absorb(jurisdiction_id  year stkcd i.jurisdiction_id#c.year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_59analysis.tex", append $reg_setting ///
addtext("Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", "Jurisdiction Specific Trend", "Y" ) 



**# Table A.15: Favorable Treatment Analysis Using Non-Ethnic Minority Area Sample

reghdfe subsidy_l pre_hiring $firm_controls if ethnic == 0 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_ethnic.tex", replace $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y" ) 


reghdfe subsidy_l pre_hiring same_place  $firm_controls  if ethnic == 0 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_ethnic.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y" ) 



reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if ethnic == 0 , absorb(jurisdiction_id  year stkcd)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_ethnic.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y" ) 


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if ethnic == 0 , absorb(jurisdiction_id  year stkcd i.jurisdiction_id#c.year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_ethnic.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", "Jurisdiction Specific Trend", "Y" ) 


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if ethnic == 0 , absorb(i.juris_firm  year)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_ethnic.tex", append $reg_setting addtext("Firm Controls", "Y", "Jurisdiction-Firm FE", "Y", "Year FE", "Y" ) 


reghdfe subsidy_l pre_hiring1 pre_hiring2 pre_hiring3 same_place rd_offic $firm_controls  if ethnic == 0 , absorb(juris_firm  year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_ethnic.tex", append $reg_setting  addtext("Firm Controls", "Y", "Jurisdiction-Firm FE", "Y", "Year FE", "Y" ) 


** Table A.16: Favorable Treatment Analysis Using Non Directly-Administered Municipality Sample


reghdfe subsidy_l pre_hiring $firm_controls if direct_muni == 0 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_direct_muni.tex", replace $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe subsidy_l pre_hiring same_place  $firm_controls  if direct_muni == 0 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_direct_muni.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 



reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if direct_muni == 0 , absorb(jurisdiction_id  year stkcd)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_direct_muni.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if direct_muni == 0 , absorb(jurisdiction_id  year stkcd i.jurisdiction_id#c.year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_direct_muni.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", "Jurisdiction Specific Trend", "Y" ) 


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if direct_muni == 0 , absorb(i.juris_firm  year)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_direct_muni.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction-Firm FE", "Y", "Year FE", "Y" ) 


reghdfe subsidy_l pre_hiring1 pre_hiring2 pre_hiring3 same_place rd_offic $firm_controls  if direct_muni == 0 , absorb(juris_firm  year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_direct_muni.tex", append $reg_setting  addtext("Firm Controls", "Y", "Jurisdiction-Firm FE", "Y", "Year FE", "Y" ) 


**# Table A.17: Favorable Treatment Analysis: SOE vs Non-SOE
g soe_prehiring = soe*pre_hiring
label var soe "SOE"
label var soe_prehiring "Future Revolver*SOE"


reghdfe subsidy_l soe_prehiring pre_hiring soe same_place rd_offic $firm_controls  , absorb(jurisdiction_id  year stkcd)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_soe.tex", replace $reg_setting /// 
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y")   cttop("Full")


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if soe == 1 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_soe.tex", append $reg_setting /// 
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y")   cttop("SOEs")


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if soe == 0 , absorb(jurisdiction_id  year stkcd)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_soe.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y")   cttop("Non-SOEs")


**# Table A.18: Exclude Tax Rebate

reghdfe subsidy_l pre_hiring $firm_controls if tax_revenue == 0 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_tax.tex", replace $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe subsidy_l pre_hiring same_place  $firm_controls  if tax_revenue == 0 , absorb(jurisdiction_id  year stkcd )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_tax.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 



reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if tax_revenue == 0 , absorb(jurisdiction_id  year stkcd)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_tax.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if tax_revenue == 0 , absorb(jurisdiction_id  year stkcd i.jurisdiction_id#c.year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_tax.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", "Jurisdiction Specific Trend", "Y" ) 


reghdfe subsidy_l pre_hiring same_place rd_offic $firm_controls  if tax_revenue == 0 , absorb(i.juris_firm  year)  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_tax.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction-Firm FE", "Y", "Year FE", "Y" ) 


reghdfe subsidy_l pre_hiring1 pre_hiring2 pre_hiring3 same_place rd_offic $firm_controls  if tax_revenue == 0 , absorb(juris_firm  year )  vce(cluster jurisdiction_id) 
outreg2 using "$reg_rd/h2_tax.tex", append $reg_setting  addtext("Firm Controls", "Y", "Jurisdiction-Firm FE", "Y", "Year FE", "Y" ) 

**# Table A.19: Alternative Measure: Procurement Value

use "~/Dropbox/revolving_door_jmp/replication_files/procurement_jop.dta", clear

encode jurisdiction, g(jurisdiction_id)
encode stkcd, g(stkcd_1)
drop stkcd
rename stkcd_1 stkcd
 
egen juris_firm =group(jurisdiction_id stkcd)


* generate log variables

g asset_l = log(TotalAsset+1)
g liability_l = log(TotalLiab+1)

lab var procument_l "Procurement Value (logged)"
lab var pre_hiring "Future Revolver"
lab var pre_hiring1 "Future Revolver in 1 yr"
lab var pre_hiring2 "Future Revolver in 2 yrs"
lab var pre_hiring3 "Future Revolver in 3 yrs"
lab var asset_l "Asset"
labe var liability_l "Liability"
lab var same_place "Same Place"
lab var rd_offic "Existing Revolvers"


reghdfe procument_l pre_hiring $firm_controls, absorb(jurisdiction  year stkcd )  vce(cluster jurisdiction) 
outreg2 using "$reg_rd/h2_procurement.tex", replace $reg_setting  ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe procument_l pre_hiring same_place  $firm_controls, absorb(jurisdiction  year stkcd )  vce(cluster jurisdiction) 
outreg2 using "$reg_rd/h2_procurement.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe procument_l pre_hiring same_place rd_offic $firm_controls, absorb(jurisdiction  year stkcd)  vce(cluster jurisdiction) 
outreg2 using "$reg_rd/h2_procurement.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", ) 


reghdfe procument_l pre_hiring same_place rd_offic $firm_controls, absorb(jurisdiction  year stkcd i.jurisdiction_id#c.year )  vce(cluster jurisdiction) 
outreg2 using "$reg_rd/h2_procurement.tex", append $reg_setting ///
addtext("Firm Controls", "Y", "Jurisdiction FE", "Y", "Firm FE", "Y", "Year FE", "Y", "Jurisdiction Specific Trend", "Y" ) 



